package com.rogo.rogobox
{
	import com.rogo.mvc.sub.facade.Facade;
	import com.rogo.rogobox.controllers.CancelFollowingCommand;
	import com.rogo.rogobox.controllers.CheckFollowingCommand;
	import com.rogo.rogobox.controllers.CommentMicroblogCommand;
	import com.rogo.rogobox.controllers.CreateFollowingCommand;
	import com.rogo.rogobox.controllers.FriendsTimeLineCommand;
	import com.rogo.rogobox.controllers.LoadFavoriteCommand;
	import com.rogo.rogobox.controllers.LoadFollowerCommand;
	import com.rogo.rogobox.controllers.LoadFriendsCommand;
	import com.rogo.rogobox.controllers.LoadMentionCommand;
	import com.rogo.rogobox.controllers.LoginCommand;
	import com.rogo.rogobox.controllers.PublishCommand;
	import com.rogo.rogobox.controllers.RepostMicroblogCommand;
	import com.rogo.rogobox.controllers.ShowCommentCommand;
	import com.rogo.rogobox.controllers.ShowNewStatusCommand;
	import com.rogo.rogobox.controllers.ShowRepostCommand;
	import com.rogo.rogobox.controllers.ShowTipCommand;
	import com.rogo.rogobox.controllers.ShowViewerCommand;
	import com.rogo.rogobox.controllers.UpdateAppCommand;
	import com.rogo.rogobox.controllers.UserProfileCommand;
	import com.rogo.rogobox.controllers.UserTimeLineCommand;
	import com.rogo.rogobox.controllers.VerifyCommand;
	import com.rogo.rogobox.models.AccountProxy;
	import com.rogo.rogobox.models.FriendshipsProxy;
	import com.rogo.rogobox.models.MicroblogProxy;
	import com.rogo.rogobox.models.TimeLineProxy;
	import com.rogo.rogobox.models.UserProxy;
	
	public class AppFacade extends Facade
	{
		public function AppFacade()
		{
			super();
		}
		
		//--------------------------------------------------------------------------
		//
		//  Constants
		//
		//--------------------------------------------------------------------------
		
		public static var instance:AppFacade;
		
		public static const NOTIFICATION:String = 'notification';
		
		/**
		 *	Login
		 */		
		public static const LOGIN:String = 'login';        					        // 登录
		public static const VERIFY:String = 'verify';								// 验证
		public static const LOGIN_RESULT:String = 'loginResult';   				    // 登录成功
		public static const LOGIN_FAIL:String = 'loginFail';            		    // 登录失败
		
		/**
		 * Friends time line 
		 */		
		public static const LOAD_FRIENDS_TIMELINE:String = 'loadFriendsTimeLine';	// 加载关注的微博
		public static const FRIENDS_TIMELINE_RESULT:String = 'friendsLineResult';   // 加载关注的微博成功
		
		/**
		 *	Loading bar
		 */		
		public static const LOADING_START:String = 'loadingStart';                  // 开始加载
		public static const LOADING_END:String = 'loadingEnd';						// 加载结束
		
		/**
		 *	Refresh user profile
		 */		
		public static const REFRESH_USER_PROFILE:String = 'refreshUserProfile';	    // 刷新用户资料
		public static const USER_PROFILE_RESULT:String = 'userProfileResult';		// 刷新用户资料成功
		
		/**
		 *	Repost 
		 */		
		public static const REPOST_MICROBLOG:String = 'repostMicroblog';			// 转发微博
		public static const REPOST_MICROBLOG_RESULT:String = 'repostMicroblogResult';// 转发成功
		public static const REPOST_MICROBLOG_ERROR:String = 'repostMicroblogError';  // 转发失败
		
		/**
		 *	Comment
		 */		
		public static const COMMENT_MICROBLOG:String = 'commentMicroblog';			// 评论微博
		public static const COMMENT_MICROBLOG_RESULT:String = 'commentMicroblogResult';// 评论成功
		public static const COMMENT_MICROBLOG_ERROR:String = 'commentMicroblogError';  // 评论失败
		
		/**
		 *	Publish new microblog 
		 */		
		public static const PUBLISH_MICROBLOG:String = 'publishMicroblog';			// 发布失败
		public static const PUBLISH_MICROBLOG_RESULT:String = 'publishMicroblogResult';// 发布成功
		public static const PUBLISH_MICROBLOG_ERROR:String = 'publishMicroblogError';  // 发布失败
		
		/**
		 *	Load user timeline 
		 */		
		public static const LOAD_USER_TIMELINE:String = 'loadUserTimeline';			// 加载用户主页
		public static const LOAD_USER_TIMELINE_RESULT:String = 'loadUserTimelineResult';// 加载成功
		public static const LOAD_USER_TIMELINE_ERROR:String = 'loadUserTimelineError';  // 加载失败
		
		/**
		 *	Display 
		 */		
		public static const DISPLAY_USER_MAIN:String = 'displayUserMain';   		// display user main page
		public static const DISPLAY_USER_PROFILE:String = 'displayUserProfile'; 	// display user profile page
		public static const DISPLAY_USER_FRIENDS:String = 'displayUserFriends';		// display user follow page
		public static const DISPLAY_USER_FOLLOWER:String = 'displayUserFollower';	// display user follower page
		public static const DISPLAY_USER_MENTIONDS:String = 'displayUserMentions';  // display user mentions page
		public static const DISPLAY_USER_FAVORITE:String = 'displayUserFavorite';	// display user favorite page
		public static const CHANGE_CONTENT_VIEW:String = 'changeContentView';		// change content view
		public static const BACK_CONTENT_VIEW:String = 'backContentView';			// back content view
		
		/**
		 *	Window 
		 */		
		public static const SHOW_VIEWER_WINDOW:String = 'showViewerWindow';     	// 显示图片查看窗口
		public static const SHOW_NEW_STATUS_WINDOW:String = 'showNewStatusWindow'; 	// 显示发布窗口
		public static const SHOW_COMMENT_WINDOW:String = 'showCommentWindow';   	// 显示评论窗口
		public static const SHOW_REPOST_WINDOW:String = 'showRepostWindow';     	// 显示转发窗口
		
		/**
		 *	Friendships
		 */		
		public static const CHECK_FOLLOWING:String = 'checkFollowing';				// 加载用户见关系
		public static const CHECK_FOLLOWING_RESULT:String = 'checkFollowingResult'; // 加载成功
		public static const CHECK_FOLLOWING_ERROR:String = 'checkFollowingError';   // 加载失败
		
		public static const CREATE_FOLLOWING:String = 'createFollowing';			// 添加关注
		public static const CREATE_FOLLOWING_RESULT:String = 'createFollowingResult';// 添加成功
		public static const CREATE_FOLLOWING_ERROR:String = 'createFollowingError';  // 添加失败
		
		public static const CANCEL_FOLLOWING:String = 'cancelFollowing';			// 取消关注
		public static const CANCEL_FOLLOWING_RESULT:String = 'cancelFollowingResult';// 取消成功
		public static const CANCEL_FOLLOWING_ERROR:String = 'cancelFollowingError'; // 取消失败
		
		public static const LOAD_FRIENDS:String = 'loadFriends';					// 加载关注列表
		public static const LOAD_FRIENDS_RESULT:String = 'loadFriendsResult';		// 加载成功
		public static const LOAD_FRIENDS_ERROR:String = 'loadFriendsError';			// 加载失败
		
		public static const LOAD_FOLLOWER:String = 'loadFollower';					// 加载粉丝
		public static const LOAD_FOLLOWER_RESULT:String = 'loadFollowerResult';		// 加载成功
		public static const LOAD_FOLLOWER_ERROR:String = 'loadFollowerError';		// 加载失败
		
		public static const LOAD_MENTION:String = 'loadMention';					// 加载@提到我的
		public static const LOAD_MENTION_RESULT:String = 'loadMentionResult';		// 加载成功
		public static const LOAD_MENTION_ERROR:String = 'loadMentionError';			// 加载失败
		
		public static const LOAD_FAVORITE:String = 'loadfavorite';					// 加载@提到我的
		public static const LOAD_FAVORITE_RESULT:String = 'loadfavoriteResult';		// 加载成功
		public static const LOAD_FAVORITE_ERROR:String = 'loadfavoriteError';			// 加载失败
		
		public static const UPDATE_APP:String = 'updateApp';						// 程序更新
		
		public static const SHOW_TIP:String = 'showTip';
		
		public static const SET_APP_ENABLE:String = 'setAppEnable';
		
		//--------------------------------------------------------------------------
		//
		//  Methods
		//
		//--------------------------------------------------------------------------
		
		public static function getInstance():AppFacade
		{
			if (!instance)  instance = new AppFacade();
			return instance;
		}
		
		//--------------------------------------------------------------------------
		//
		//  Overridden Methods
		//
		//--------------------------------------------------------------------------
		
		override protected function initController():void
		{
			super.initController();
			registerCommand(AppFacade.LOGIN, LoginCommand);					      	  
			registerCommand(AppFacade.VERIFY, VerifyCommand);
			registerCommand(AppFacade.LOAD_FRIENDS_TIMELINE, FriendsTimeLineCommand); 
			registerCommand(AppFacade.REFRESH_USER_PROFILE, UserProfileCommand);
			registerCommand(AppFacade.REPOST_MICROBLOG, RepostMicroblogCommand);
			registerCommand(AppFacade.COMMENT_MICROBLOG, CommentMicroblogCommand);
		    registerCommand(AppFacade.PUBLISH_MICROBLOG, PublishCommand);
			registerCommand(AppFacade.LOAD_USER_TIMELINE, UserTimeLineCommand);
			registerCommand(AppFacade.SHOW_VIEWER_WINDOW, ShowViewerCommand);
			registerCommand(AppFacade.SHOW_NEW_STATUS_WINDOW, ShowNewStatusCommand);
		    registerCommand(AppFacade.SHOW_COMMENT_WINDOW, ShowCommentCommand);
			registerCommand(AppFacade.SHOW_REPOST_WINDOW, ShowRepostCommand);
			registerCommand(AppFacade.CHECK_FOLLOWING, CheckFollowingCommand);
		    registerCommand(AppFacade.CREATE_FOLLOWING, CreateFollowingCommand);
			registerCommand(AppFacade.CANCEL_FOLLOWING, CancelFollowingCommand);
			registerCommand(AppFacade.LOAD_FRIENDS, LoadFriendsCommand);
			registerCommand(AppFacade.LOAD_FOLLOWER, LoadFollowerCommand);
			registerCommand(AppFacade.LOAD_MENTION, LoadMentionCommand);
			registerCommand(AppFacade.LOAD_FAVORITE, LoadFavoriteCommand);
			registerCommand(AppFacade.UPDATE_APP, UpdateAppCommand);
			registerCommand(AppFacade.SHOW_TIP, ShowTipCommand);
		}
		
		override protected function initModel():void
		{
			super.initModel();
			registerProxy(new TimeLineProxy());		// 1.1
			registerProxy(new MicroblogProxy());    // 1.2
			registerProxy(new UserProxy());			// 1.3
		    registerProxy(new FriendshipsProxy());  // 1.4
			registerProxy(new AccountProxy());		// 1.10
		}
		
	}
}